package com.atguigu.springcloud.service;

import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author jxau_scf
 * @date 2021/8/30 - 11:43
 */
@Component
public class PaymentService {

    public String paymentInfo_OK(Integer id){
        return "线程池：" + Thread.currentThread().getName() + "paymentInfo_OK: " + id + "\t" + "哈哈哈";
    }

    public String paymentInfo_TimeOut(Integer id){
        int time_out = 3;
        try {
            TimeUnit.SECONDS.sleep(time_out);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "线程池：" + Thread.currentThread().getName() + "paymentInfo_TimeOut: " + id + "\t" + "哈哈哈" + "耗时： " + time_out+" 秒钟" ;
    }
}
